import React from 'react';
import { Button } from 'antd';
import EmailNewForDialog from './EmailNewForDialog';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;
class TestDialog extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      visible: false,
    };
  }
  onTestClick = () => {
    window.eventRegister.start('f_email', { request: 'test' }, () => {
      this.setState({ visible: true });
      this.forceUpdate();
    });
  };
  onCancel = () => {
    this.setState({ visible: false });
  };
  render() {
    return (
      <div>
        <Button
          ecId={`${
            (this && this.props && this.props.ecId) || ''
          }_Button@yv326h`}
          onClick={this.onTestClick}
        >
          {getLabel('506454', '点击异步加载')} email new
        </Button>
        {window.weaEmail && (
          <EmailNewForDialog
            ecId={`${
              (this && this.props && this.props.ecId) || ''
            }_EmailNewForDialog@cluszo`}
            // <window.weaEmail.components.EmailNewForDialog
            visible={this.state.visible}
            onCancel={this.onCancel}
            /*   fwquery={{
              subject: 'xxxxxx',
              content: `<a href="javaScript:openSPA4Single('/main/workflow/req?requestid=5177244&amp;_workflowid=232&amp;_workflowtype=&amp;isovertime=0',5177244)" class="noWrap" title="（请处理）移动端多人力资源字段选择时不显示部门人员信息（客户名称:一汽马自达汽车销售有限公司, 记录QC号（内部）:440160, 客户价值:A-一级响应客户, 客户属性:B-实施当中客户）">（请处理）移动端多人力资源字段选择时不显示部门人员信息<b><b>（客户名称:一汽马自达汽车销售有限公司, 记录QC号（内部）:440160, 客户价值:A-一级响应客户, 客户属性:B-实施当中客户）</b></b></a>`,
              internalto: "316,318",
              requestid: '123'
            }} */
            initSentQuery={{
              isInternal: '0',
              to: '15295790726@163.com',
            }}
            random={Math.random()}
          />
        )}
      </div>
    );
  }
}

export default TestDialog;
